package com.yanqu.road.dao.impl.servercenter;

import com.yanqu.road.dao.db.DbNameStrategy;
import com.yanqu.road.dao.impl.TempDao;
import com.yanqu.road.entity.activity.*;
import com.yanqu.road.entity.activity.commonteam.config.ActivityTeamConfig;
import com.yanqu.road.entity.activity.cookboy.CookBoyConfig;
import com.yanqu.road.entity.activity.cookboy.CookBoyFoodConfig;
import com.yanqu.road.entity.activity.cookboy.process2.CookBoy2DishConfig;
import com.yanqu.road.entity.activity.drawPictures.PicturesComb;
import com.yanqu.road.entity.activity.drawPictures.PicturesWeight;
import com.yanqu.road.entity.activity.holiday.ActivityCatMerge;
import com.yanqu.road.entity.activity.snowgarden.config.SnowGardenBuyConfig;
import com.yanqu.road.entity.enums.ActivityTypeCheck;
import com.yanqu.road.entity.enums.eActivityType;
import com.yanqu.road.entity.estatewar.palace.PalaceFloorConfig;
import com.yanqu.road.entity.activity.treasure.TreasureActivityPlace;
import com.yanqu.road.entity.config.goods.MallInfo;
import com.yanqu.road.entity.crossorewar.CrossOreStationInfo;
import com.yanqu.road.entity.orewar.OreStationInfo;
import com.yanqu.road.utils.date.DateHelper;
import com.yanqu.road.utils.property.PropertyHelper;
import com.yanqu.road.utils.string.StringUtils;

import java.math.BigInteger;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 活动
 */
public class ActivityDaoImpl extends TempDao {


	public Map<Integer,ActivityInfo> getAllRunningActivityInfoMap(){
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_main where beginShowTime <= ? AND ? <= endShowTime and gameType = 0";
		try {
			long beginShowTime = DateHelper.getCurrentTime();
			beginShowTime += DateHelper.HOUR_MILLIONS * 12;
			String beginShowTimeStr = DateHelper.getCurrentDateTimeString(beginShowTime);

			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, beginShowTimeStr);
			call.setString(2, DateHelper.getCurrentDateTimeString());
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	//通过activityId获取数据库的单个活动
	public ActivityInfo getActivityInfoByActivityId(int activityId){
		ResultSet rs = null;
		CallableStatement call = null;
		String sql = "select * from t_s_activity_main where activityId = ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setInt(1, activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				return data;
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return null;
	}

	public Map<Integer, ActivityInfo> getActivityInfoMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> activityInfoMap = new ConcurrentHashMap<>();
		if(activityIdList.size() <= 0){
			return activityInfoMap;
		}
		String sql = "select * from t_s_activity_main where activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				activityInfoMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return activityInfoMap;
	}

	public Map<Integer, ActivityInfo> getActivityInfoMap(List<Integer> activityIdList, long serverId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> activityInfoMap = new ConcurrentHashMap<>();
		if(activityIdList.size() <= 0){
			return activityInfoMap;
		}
		String sql = "select * from t_s_activity_main where activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				if (ActivityTypeCheck.isOnlyNeedOneServerActivity(data.getType())) {//不需要其他区服id的活动
					data.setServerIdList(Collections.singletonList(serverId));
					data.setServerListStr(serverId + "");
				}
				activityInfoMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return activityInfoMap;
	}



	public Map<Integer, ActivityInfo> getActivityInfoMap(long serverId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_main where serverList LIKE ? and endShowTime> ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, "%" + serverId + "%");
			long nowTime = System.currentTimeMillis();
			long queryTime = nowTime - 30 * DateHelper.DAY_MILLIONS;
			String timeStr = DateHelper.getCurrentDateTimeString(queryTime);
			call.setString(2, timeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				if (ActivityTypeCheck.isOnlyNeedOneServerActivity(data.getType())) {//不需要其他区服id的活动
					data.setServerIdList(Collections.singletonList(serverId));
					data.setServerListStr(serverId + "");
				}
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public List<SimpleActivityInfo> getAllActivityList() {
		ResultSet rs = null;
		CallableStatement call = null;
		List<SimpleActivityInfo> list = new ArrayList<>();
		long selectTime = System.currentTimeMillis() - 60 * DateHelper.DAY_MILLIONS;
		String selectTimeStr = DateHelper.getCurrentDateTimeString(selectTime);
		String sql = "select activityId,type,beginShowTime,endShowTime,serverList,serverList2 from t_s_activity_main where gameType = 0 and endShowTime > ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, selectTimeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				SimpleActivityInfo simpleActivityInfo = new SimpleActivityInfo();

				simpleActivityInfo.setActivityId(rs.getInt("activityId"));
				simpleActivityInfo.setType(rs.getInt("type"));
				simpleActivityInfo.setBeginShowTime(rs.getTimestamp("beginShowTime").getTime() / 1000);
				simpleActivityInfo.setEndShowTime(rs.getTimestamp("endShowTime").getTime() / 1000);
				String str = rs.getString("serverList");
				simpleActivityInfo.setServerIdList(new HashSet<Integer>(StringUtils.stringToIntegerList(str == null ? "" : str, ",")));
				str = rs.getString("serverList2");
				simpleActivityInfo.setServerIdList2(StringUtils.stringToIntegerList(str == null ? "" : str, ","));
				list.add(simpleActivityInfo);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return list;
	}


	public Map<Integer, SimpleActivityInfo> getSimpleActivityInfoMap() {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, SimpleActivityInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select activityId,type,beginShowTime,endShowTime,serverList,serverList2 from t_s_activity_main where `type` in (50,208)  and endShowTime> ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			long nowTime = System.currentTimeMillis();
			long queryTime = nowTime - 1 * DateHelper.DAY_MILLIONS;
			String timeStr = DateHelper.getCurrentDateTimeString(queryTime);
			call.setString(1, timeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				SimpleActivityInfo simpleActivityInfo = new SimpleActivityInfo();

				simpleActivityInfo.setActivityId(rs.getInt("activityId"));
				simpleActivityInfo.setType(rs.getInt("type"));
				simpleActivityInfo.setBeginShowTime(rs.getTimestamp("beginShowTime").getTime() / 1000);
				simpleActivityInfo.setEndShowTime(rs.getTimestamp("endShowTime").getTime() / 1000);
				String str = rs.getString("serverList");
				simpleActivityInfo.setServerIdList(new HashSet<Integer>(StringUtils.stringToIntegerList(str == null ? "" : str, ",")));

				String str2 = rs.getString("serverList2");
				if(StringUtils.isNullOrEmpty(str2)){
					simpleActivityInfo.setServerIdList2(Collections.emptyList());
				}else {
					simpleActivityInfo.setServerIdList2(StringUtils.stringToIntegerList(str2, ","));
				}
				dataMap.put(simpleActivityInfo.getActivityId(), simpleActivityInfo);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, ActivityInfo> getOpenCrossRankActivityInfoMap(List<Integer> activityTypeList, String selectTimeStr) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		if(null == activityTypeList || activityTypeList.size() <= 0){
			return dataMap;
		}

		Date string2Date = DateHelper.getString2Date(selectTimeStr);
		long beginShowTime = string2Date.getTime();
		beginShowTime += DateHelper.HOUR_MILLIONS*12;
		String beginShowTimeStr = DateHelper.getCurrentDateTimeString(beginShowTime);

		String activityTypeCondition = "type in(" + StringUtils.listToString(activityTypeList, ",") + ")";
		String sql = "select * from t_s_activity_main where " + activityTypeCondition + " and endShowTime>? and beginShowTime<=? and gameType = 0";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, selectTimeStr);
			call.setString(2, beginShowTimeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, ActivityInfo> getRMBMallActivityInfoMap(List<Integer> activityTypeList, long serverId, String selectTimeStr) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		if(null == activityTypeList || activityTypeList.size() <= 0){
			return dataMap;
		}
		String activityTypeCondition = "type in(" + StringUtils.listToString(activityTypeList, ",") + ") ";
		String sql = "select * from t_s_activity_main where " + activityTypeCondition + " and serverList LIKE ? and beginShowTime<=? and endShowTime>?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, "%" + serverId + "%");
			call.setString(2, selectTimeStr);
			call.setString(3, selectTimeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	private ActivityInfo initActivityInfo(ResultSet rs) throws SQLException {
		ActivityInfo data = new ActivityInfo();
		data.setActivityId(rs.getInt("activityId"));
		data.setActivityName(rs.getString("activityName"));
		data.setActivityDesc(rs.getString("activityDesc"));
		data.setType(rs.getInt("type"));
		data.setChildType(rs.getInt("childType"));
		data.setBeginShowTime(rs.getTimestamp("beginShowTime").getTime() / 1000);
		data.setEndShowTime(rs.getTimestamp("endShowTime").getTime() / 1000);
		data.setBeginTime(rs.getTimestamp("beginTime").getTime() / 1000);
		data.setEndTime(rs.getTimestamp("endTime").getTime() / 1000);
		data.setIcon(rs.getString("icon"));
		data.setOrder(rs.getInt("order"));
		data.setParam1(rs.getString("param1"));
		data.setParam2(rs.getString("param2"));
		data.setParam3(rs.getString("param3"));
		data.setParam4(rs.getString("param4"));
		data.setParam5(rs.getString("param5"));
		data.setParam6(rs.getString("param6"));
		data.setUnionGroup(rs.getString("unionGroup"));
		data.setServerListStr(rs.getString("serverList"));
		data.setServerIdList(StringUtils.stringToLongList(data.getServerListStr(), ","));
		data.setServerListStr2(rs.getString("serverList2"));
		data.setCrossId(rs.getLong("crossServerId"));
		return data;
	}

	public void getActivityConditionInfoMap(Map<Integer, Map<Integer, List<ActivityConditionInfo>>> activityConditionInfoTypeMap,
			Map<Integer, List<ActivityConditionInfo>> activityConditionInfoMap, List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		if(null != activityIdList && activityIdList.size() > 0) {
			String sql = "select * from t_s_activity_condition where activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
			try {
				getDb().setConnName(DbNameStrategy.getServerDb());
				call = getDb().getConnection().prepareCall(sql);
				rs = call.executeQuery();
				while (rs.next()) {
					ActivityConditionInfo data = initActivityConditionInfo(rs);

					if (!activityConditionInfoMap.containsKey(data.getActivityId())) {
						activityConditionInfoMap.put(data.getActivityId(), new ArrayList<>());
					}
					activityConditionInfoMap.get(data.getActivityId()).add(data);
					if (!activityConditionInfoTypeMap.containsKey(data.getActivityId())) {
						activityConditionInfoTypeMap.put(data.getActivityId(), new ConcurrentHashMap<>());
					}
					Map<Integer, List<ActivityConditionInfo>> dataMap = activityConditionInfoTypeMap.get(data.getActivityId());
					if (!dataMap.containsKey(data.getType())) {
						dataMap.put(data.getType(), new ArrayList<>());
					}
					dataMap.get(data.getType()).add(data);
				}
			} catch (Exception e) {
				throw new RuntimeException(e);
			} finally {
				getDb().closeConnection(call, rs);
			}
		}
	}

	public Map<Integer, List<ActivityConditionInfo>> getOpenCrossRankActivityConditionInfoMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, List<ActivityConditionInfo>> dataMap = new ConcurrentHashMap<>();
		if(activityIdList.size() <= 0){
			return dataMap;
		}
		String sql = "select * from t_s_activity_condition where activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityConditionInfo data = initActivityConditionInfo(rs);

				if (!dataMap.containsKey(data.getActivityId())) {
					dataMap.put(data.getActivityId(), new ArrayList<>());
				}
				dataMap.get(data.getActivityId()).add(data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	private ActivityConditionInfo initActivityConditionInfo(ResultSet rs) throws SQLException {
		ActivityConditionInfo data = new ActivityConditionInfo();
		data.setConditionId(rs.getInt("id"));
		data.setActivityId(rs.getInt("activityId"));
		data.setTitle(rs.getString("title"));
		data.setDesc(rs.getString("desc"));
		data.setType(rs.getInt("type"));
		data.setRewardStr(rs.getString("rewards"));
		data.setParamStr(rs.getString("params"));
		data.setReward(PropertyHelper.parseStringToProperty(data.getRewardStr()));
		data.setParamList(StringUtils.stringToBigIntegerList(data.getParamStr(), "\\|"));
		String value = rs.getString("extendParam");
		if(!StringUtils.isNullOrEmpty(value)){
			data.setExtendParam(value);
		}
		//职位奖励 会长奖励|副会长奖励|精英奖励
        data.setPositionRewardStr(rs.getString("masterRewards"));
        List<String> positionStrList = StringUtils.stringToStringList(data.getPositionRewardStr(), "\\|");
        if (positionStrList.size() > 0 && !StringUtils.isNullOrEmpty(positionStrList.get(0))) {
            data.setMasterReward(PropertyHelper.parseStringToProperty(positionStrList.get(0)));
            data.setMasterRewardStr(positionStrList.get(0));
        }
        if (positionStrList.size() > 1 && !StringUtils.isNullOrEmpty(positionStrList.get(1))) {
            data.setDeputyMasterRewardStr(positionStrList.get(1));
        }
        if (positionStrList.size() > 2 && !StringUtils.isNullOrEmpty(positionStrList.get(2))) {
            data.setEliteRewardStr(positionStrList.get(2));
        }
        data.setActtype(rs.getString("acttype"));
        data.setSubText(rs.getString("subText"));
        data.setIsOneBuy(rs.getString("isOneBuy"));
		return data;
	}

	public Map<Integer, Map<Integer, MallInfo>> getActivityMallInfoMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<Integer, MallInfo>> dataMap = new ConcurrentHashMap<>();
		if(null == activityIdList || activityIdList.size() <= 0){
			return dataMap;
		}
		String sql = "select * from t_s_activity_mall where activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				MallInfo data = new MallInfo(rs);
				if(!dataMap.containsKey(data.getActivityId())){
					dataMap.put(data.getActivityId(), new ConcurrentHashMap<>());
				}
				dataMap.get(data.getActivityId()).put(data.getMallId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, Map<String, ActivityConfig>> getActivityConfigMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<String, ActivityConfig>> dataMap = new ConcurrentHashMap<>();
		if(null == activityIdList || activityIdList.size() <= 0){
			return dataMap;
		}
		String sql = "select * from t_s_activity_config where activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityConfig config = new ActivityConfig();
				config.setActivityId(rs.getInt("activityId"));
				config.setId(rs.getInt("id"));
				config.setParam(rs.getString("param").trim().replaceAll("\\u00A0",""));
				config.setValue(rs.getString("value"));
				if(!dataMap.containsKey(config.getActivityId())){
					dataMap.put(config.getActivityId(), new ConcurrentHashMap<>());
				}
				dataMap.get(config.getActivityId()).put(config.getParam(), config);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, OreStationInfo> getOreWarStationInfoMap(int activityId) {
		Map<Integer, OreStationInfo> dataMap = new ConcurrentHashMap<>();
		ResultSet rs = null;
		CallableStatement call = null;
		String sql = "select * from t_s_activity_orewar where activityId = ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			call.setInt(i++,activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				OreStationInfo data = new OreStationInfo();
				data.setActivityId(rs.getInt("activityId"));
				data.setStationId(rs.getInt("id"));
				data.setPosition(rs.getInt("pos"));
				data.setIcon(rs.getString("icon"));
				data.setStationName(rs.getString("name"));
				data.setPitCount(rs.getInt("capacity"));
				data.setOutputSpeedAddition(rs.getInt("outputNum"));
				data.setAddOutputSpeedAddition(rs.getInt("outNumAdd"));
				data.setShowAbility(rs.getBoolean("isShowPower"));
				data.setShowStationIndex(rs.getInt("descNum"));
				data.setBlowoutWeight(rs.getInt("blowoutWeight"));
				data.setNotice(rs.getBoolean("isNotice"));
				dataMap.put(data.getStationId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, Map<Integer, ActivityCatMerge>> getActivityCatMergeInfoMap(List<Integer> activityIdList){
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<Integer, ActivityCatMerge>> dataMap = new ConcurrentHashMap<>();
		if(null == activityIdList || activityIdList.size() <= 0){
			return dataMap;
		}
		String sql = "select * from t_s_activity_cat_merge where activityId in(" + StringUtils.listToString(activityIdList, ",") + ") order by level asc";

		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityCatMerge data = new ActivityCatMerge();
				data.setActivityId(rs.getInt("activityId"));
				data.setId(rs.getInt("id"));
				data.setIcon(rs.getString("icon"));
				data.setDesc(rs.getString("desc"));
				data.setName(rs.getString("name"));
				data.setLevel(rs.getInt("level"));
				data.setWeight(rs.getInt("weight"));
				data.setMergeNum(rs.getInt("mergeNum"));
				data.setScore(rs.getInt("score"));
				data.setProbably(rs.getInt("probably"));
				data.setFrequency(rs.getInt("frequency"));
				if(!dataMap.containsKey(data.getActivityId())){
					dataMap.put(data.getActivityId(), new ConcurrentHashMap<>());
				}
				dataMap.get(data.getActivityId()).put(data.getLevel(), data);
			}
		}catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, CrossOreStationInfo> getCrossOreWarStationInfoMap(int activityId) {
		Map<Integer, CrossOreStationInfo> dataMap = new ConcurrentHashMap<>();
		ResultSet rs = null;
		CallableStatement call = null;
		String sql = "select * from t_s_activity_orewar where activityId = ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			call.setInt(i++,activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				CrossOreStationInfo data = new CrossOreStationInfo();
				data.setActivityId(rs.getInt("activityId"));
				data.setStationId(rs.getInt("id"));
				data.setPosition(rs.getInt("pos"));
				data.setIcon(rs.getString("icon"));
				data.setStationName(rs.getString("name"));
				data.setPitCount(rs.getInt("capacity"));
				data.setOutputSpeedAddition(rs.getInt("outputNum"));
				data.setAddOutputSpeedAddition(rs.getInt("outNumAdd"));
				data.setShowAbility(rs.getBoolean("isShowPower"));
				data.setShowStationIndex(rs.getInt("descNum"));
				data.setBlowoutWeight(rs.getInt("blowoutWeight"));
				data.setNotice(rs.getBoolean("isNotice"));
				dataMap.put(data.getStationId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}


    public Map<Integer, List<TreasureActivityPlace>> getActivityPlaceMapInfoMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, List<TreasureActivityPlace>> dataMap = new ConcurrentHashMap<>();
		if(null == activityIdList || activityIdList.size() <= 0){
			return dataMap;
		}
		String sql = "select * from t_s_activity_place where activityId in(" + StringUtils.listToString(activityIdList, ",") + ") order by id asc";

		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				TreasureActivityPlace data = new TreasureActivityPlace();
				data.setActivityId(rs.getInt("activityId"));
				data.setId(rs.getInt("id"));
				data.setIcon(rs.getString("icon"));
				data.setDesc(rs.getString("desc"));
				data.setName(rs.getString("name"));
				data.setEventDesc(rs.getString("eventDesc"));
				data.setPlaceCoordinate(rs.getString("placeCoordinate"));
				data.setRouteCoordinateLists(rs.getString("routeCoordinateLists"));
				data.setRewardBox(rs.getInt("rewards"));
				data.setTokenRewards(rs.getString("tokenRewards"));

				if(!StringUtils.isNullOrEmpty(data.getRouteCoordinateLists())){
					List<String> routList = StringUtils.stringToStringList(data.getRouteCoordinateLists(), "\\|");
					data.setRouteSize(routList.size());
				}
				if(!dataMap.containsKey(data.getActivityId())){
					dataMap.put(data.getActivityId(), new ArrayList<>());
				}
				dataMap.get(data.getActivityId()).add(data);
			}
		}catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
    }

	public Map<Integer, Map<Integer, PicturesComb>> getPicturesCombConfigMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<Integer, PicturesComb>> dataMap = new ConcurrentHashMap<>();
		if(null == activityIdList || activityIdList.size() <= 0){
			return dataMap;
		}
		String sql = "select * from t_s_activity_nianhua_comb where activityId in(" + StringUtils.listToString(activityIdList, ",") + ") order by combId asc";

		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				PicturesComb data = new PicturesComb();
				data.setActivityId(rs.getInt("activityId"));
				data.setCombId(rs.getInt("combId"));
				data.setName(rs.getString("name"));
				data.setElement(rs.getString("element"));
				data.setIntegral(rs.getInt("integral"));
				data.setSort(rs.getInt("sort"));
				data.setRewards(rs.getString("rewards"));
				data.setQuality(rs.getInt("quality"));
				data.setLimit(rs.getInt("limit"));
				if (!dataMap.containsKey(data.getActivityId())) {
					dataMap.put(data.getActivityId(), new ConcurrentHashMap<>());
				}
				dataMap.get(data.getActivityId()).put(data.getCombId(), data);
			}
		}catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, Map<Integer, PicturesWeight>> getPicturesWeightConfigMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<Integer, PicturesWeight>> dataMap = new ConcurrentHashMap<>();
		if(null == activityIdList || activityIdList.size() <= 0){
			return dataMap;
		}
		String sql = "select * from t_s_activity_nianhua_weight where activityId in(" + StringUtils.listToString(activityIdList, ",") + ") order by id asc";

		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				PicturesWeight data = new PicturesWeight();
				data.setActivityId(rs.getInt("activityId"));
				data.setId(rs.getInt("id"));
				data.setName(rs.getString("name"));
				data.setOriginDesc(rs.getString("originDesc"));
				data.setDesc(rs.getString("desc"));
				data.setQuality(rs.getInt("quality"));
				data.setWeight(rs.getInt("weight"));
				data.setIntegral(rs.getInt("integral"));
				data.setOriginPoem(rs.getString("originPoem"));
				data.setTransformIntegral(rs.getInt("transformIntegral"));
				data.setSort(rs.getInt("sort"));
				if (!dataMap.containsKey(data.getActivityId())) {
					dataMap.put(data.getActivityId(), new ConcurrentHashMap<>());
				}
				dataMap.get(data.getActivityId()).put(data.getId(), data);
			}
		}catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}
	public Map<Integer, ActivityInfo> getOpenCrossRankActivityInfoMapByCrossServerId(List<Integer> activityTypeList, String nowTimeStr, long crossServerId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		if (null == activityTypeList || activityTypeList.size() <= 0) {
			return dataMap;
		}
		Date string2Date = DateHelper.getString2Date(nowTimeStr);
		long beginShowTime = string2Date.getTime();
		beginShowTime += DateHelper.HOUR_MILLIONS*12;
		String beginShowTimeStr = DateHelper.getCurrentDateTimeString(beginShowTime);

		String activityTypeCondition = "type in(" + StringUtils.listToString(activityTypeList, ",") + ")";
		String sql = "select * from t_s_activity_main where " + activityTypeCondition + " and endShowTime>? and beginShowTime<=? and crossServerId = ? and gameType=0";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, nowTimeStr);
			call.setString(2, beginShowTimeStr);
			call.setLong(3, crossServerId);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, ActivityInfo> getExpireActivityInfoMapByType(long serverId, int type, int childType) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_main where endShowTime<? and `type`=? and childType=? and serverList LIKE ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			call.setString(i++, DateHelper.getCurrentDateTimeString());
			call.setInt(i++, type);
			call.setInt(i++, childType);
			call.setString(i++, "%" + serverId + "%");
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, Map<String, CookBoyConfig>> getCookBoyActivityConfig(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<String, CookBoyConfig>> dataMap = new ConcurrentHashMap<>();
		if(activityIdList.size() == 0){
			return dataMap;
		}
		String activityIdCondition = "activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		String sql = "select * from t_s_activity_config where " + activityIdCondition + "";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			rs = call.executeQuery();
			while (rs.next()) {
				CookBoyConfig data = iniCookBoyConfig(rs);
				if(!dataMap.containsKey(data.getActivityId())){
					dataMap.put(data.getActivityId(),new ConcurrentHashMap<>());
				}
				dataMap.get(data.getActivityId()).put(data.getParam(),data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	private CookBoyConfig iniCookBoyConfig(ResultSet rs) throws SQLException {
		CookBoyConfig data = new CookBoyConfig();
		data.setActivityId(rs.getInt("activityId"));
		data.setId(rs.getInt("id"));
		data.setParam(rs.getString("param"));
		data.setValue(rs.getString("value"));
		return data;
	}

	public Map<Integer, Map<Integer, CookBoyFoodConfig>> getCookBoyActivityFoodConfig(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<Integer, CookBoyFoodConfig>> dataMap = new ConcurrentHashMap<>();
		if(activityIdList.size() == 0){
			return dataMap;
		}
		String activityIdCondition = "activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		String sql = "select * from t_s_activity_cookboy_food where " + activityIdCondition + "";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			rs = call.executeQuery();
			while (rs.next()) {
				CookBoyFoodConfig data = iniCookBoyFoodConfig(rs);
				if(!dataMap.containsKey(data.getActivityId())){
					dataMap.put(data.getActivityId(),new ConcurrentHashMap<>());
				}
				dataMap.get(data.getActivityId()).put(data.getCookingOrder(),data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, Map<Integer, CookBoy2DishConfig>> getCookBoy2ActivityDishConfig(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, Map<Integer, CookBoy2DishConfig>> dataMap = new ConcurrentHashMap<>();
		if(activityIdList.size() == 0){
			return dataMap;
		}
		String activityIdCondition = "activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		String sql = "select * from t_s_activity_cookboy_dish where " + activityIdCondition + "";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			rs = call.executeQuery();
			while (rs.next()) {
				CookBoy2DishConfig data = iniCookBoy2DishConfig(rs);
				if(!dataMap.containsKey(data.getActivityId())){
					dataMap.put(data.getActivityId(),new ConcurrentHashMap<>());
				}
				dataMap.get(data.getActivityId()).put(data.getId(),data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public List<PalaceFloorConfig> getPalaceFloorConfigList(int activityId) {
		ResultSet rs = null;
		CallableStatement call = null;
		List<PalaceFloorConfig> dataList = new ArrayList<>();
		String sql = "select * from t_s_activity_palace where activityId=?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setInt(1, activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				PalaceFloorConfig data = initPalaceFloorConfig(rs);
				dataList.add(data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataList;
	}

	public Map<Integer, PalaceFloorConfig> getPalaceFloorConfigMap(int activityId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, PalaceFloorConfig> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_palace where activityId=?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setInt(1, activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				PalaceFloorConfig data = initPalaceFloorConfig(rs);
				dataMap.put(data.getPos(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}


	private CookBoyFoodConfig iniCookBoyFoodConfig(ResultSet rs) throws SQLException {
		CookBoyFoodConfig data = new CookBoyFoodConfig();
		data.setActivityId(rs.getInt("activityId"));
		data.setCookingId(rs.getInt("cookingId"));
		data.setCookingOrder(rs.getInt("cookingOrder"));
		data.setUnlockCondition(rs.getInt("unlockCondition"));
		data.setAddScore(rs.getInt("addScore"));
		return data;
	}

	private CookBoy2DishConfig iniCookBoy2DishConfig(ResultSet rs) throws SQLException {
		CookBoy2DishConfig data = new CookBoy2DishConfig();
		data.setActivityId(rs.getInt("activityId"));
		data.setId(rs.getInt("id"));
		data.setQuality(rs.getInt("quality"));
		data.setMenu(rs.getString("menu"));
		data.setWeight(rs.getInt("weight"));
		data.setSeat(rs.getInt("seat"));
		data.setScore(rs.getInt("score"));
		return data;
	}

	private PalaceFloorConfig initPalaceFloorConfig(ResultSet rs) throws SQLException {
		PalaceFloorConfig data = new PalaceFloorConfig();
		data.setActivityId(rs.getInt("activityId"));
		data.setTitleType(rs.getInt("titleType"));
		data.setPos(rs.getInt("pos"));
		data.setNpcName(rs.getString("npcName"));
		data.setNpcPic(rs.getString("npcPic"));
		BigInteger earnSpeed = BigInteger.ZERO;
		String param = rs.getString("npcEarnSpeed");
		if(!StringUtils.isNullOrEmpty(param)){
			earnSpeed = new BigInteger(param);
		}
		data.setNpcEarnSpeed(earnSpeed);
		data.setRecruitNum(rs.getInt("recruitNum"));
		data.setRecruitReward(rs.getString("recruitReward"));
		data.setDailyReward(rs.getString("dailyReward"));
		data.setSkinsReward(rs.getInt("skinsReward"));
		return data;
	}


	public Map<Integer, List<ActivityTableExt>> getActivityTableExtMap(List<Integer> activityIdList) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, List<ActivityTableExt>> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_table_ext where activityId in(" + StringUtils.listToString(activityIdList, ",") + ")";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityTableExt activityTableExt = new ActivityTableExt();
				activityTableExt.setActivityId(rs.getInt("activityId"));
				activityTableExt.setTableName(rs.getString("tableName"));
				activityTableExt.setExt(rs.getString("ext"));
				activityTableExt.setCreateTime(rs.getDate("createTime"));
				if (!dataMap.containsKey(activityTableExt.getActivityId())) {
					dataMap.put(activityTableExt.getActivityId(), new ArrayList<>());
				}
				List<ActivityTableExt> list = dataMap.get(activityTableExt.getActivityId());
				list.add(activityTableExt);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, ActivityInfo> getOpenActivityInfoMap(eActivityType activityType, String nowTimeStr, long crossServerId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_main where type = " + activityType.getValue() + " and  endShowTime>=? and crossServerId = ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, nowTimeStr);
			call.setLong(2, crossServerId);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, ActivityInfo> getActivityInfoMapByType(int type, int childType) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_main where beginShowTime < ? and endShowTime > ? and `type`=? and childType=? order by activityId";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			call.setString(i++, DateHelper.getCurrentDateTimeString());
			call.setString(i++, DateHelper.getCurrentDateTimeString());
			call.setInt(i++, type);
			call.setInt(i++, childType);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, ActivityInfo> getOpenActivityInfoMap(eActivityType activityType, int childType, String nowTimeStr) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_main where type = " + activityType.getValue() + " and childType=? and endShowTime>=?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setInt(1, childType);
			call.setString(2, nowTimeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Map<Integer, ActivityInfo> getNoEndActivityInfoMap(List<Integer> activityTypeList, String selectTimeStr) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, ActivityInfo> dataMap = new ConcurrentHashMap<>();
		if (null == activityTypeList || activityTypeList.size() <= 0) {
			return dataMap;
		}
		String activityTypeCondition = "type in(" + StringUtils.listToString(activityTypeList, ",") + ")";
		String sql = "select * from t_s_activity_main where " + activityTypeCondition + " and endShowTime>?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setString(1, selectTimeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityInfo data = initActivityInfo(rs);
				dataMap.put(data.getActivityId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	public Set<Long> getAllOpenServerListByActivityType(int activityType, String selectTimeStr) {
		ResultSet rs = null;
		CallableStatement call = null;
		Set<Long> serverIdList = new HashSet<>();
		String sql = "select * from t_s_activity_main where type=? and endShowTime>? and beginShowTime<=?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			call.setInt(1, activityType);
			call.setString(2, selectTimeStr);
			call.setString(3, selectTimeStr);
			rs = call.executeQuery();
			while (rs.next()) {
				String serverListStr = rs.getString("serverList");
				List<Long> ids = StringUtils.stringToLongList(serverListStr, ",");
				serverIdList.addAll(ids);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return serverIdList;
	}

	public Map<Integer, SnowGardenBuyConfig> getServerBuyMallConfig(int activityId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, SnowGardenBuyConfig> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_snowgarden_buy where activityId=?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			call.setInt(i++, activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				SnowGardenBuyConfig data = iniServerBuyMallConfig(rs);
				dataMap.put(data.getId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	private SnowGardenBuyConfig iniServerBuyMallConfig(ResultSet rs) throws SQLException {
		SnowGardenBuyConfig data = new SnowGardenBuyConfig();
		data.setActivityId(rs.getInt("activityId"));
		data.setId(rs.getInt("id"));
		data.setTargetPeople(rs.getString("targetPeople"));
		data.setJudgeTime(rs.getLong("judgeTime"));
		data.setIntervalTime(rs.getLong("intervalTime"));
		return data;
	}

	public Map<Integer, MallInfo> getActivityMallInfoMap(int activityId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<Integer, MallInfo> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_mall where activityId=?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			call.setInt(i++, activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				MallInfo data = new MallInfo(rs);
				dataMap.put(data.getMallId(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}

	/**
	 * 获取组队配置
	 * @param activityId
	 * @return
	 */
	public Map<String, ActivityTeamConfig> getActivityTeamConfigMap(int activityId) {
		ResultSet rs = null;
		CallableStatement call = null;
		Map<String, ActivityTeamConfig> dataMap = new ConcurrentHashMap<>();
		String sql = "select * from t_s_activity_team where activityId = ?";
		try {
			getDb().setConnName(DbNameStrategy.getServerDb());
			call = getDb().getConnection().prepareCall(sql);
			int i = 1;
			call.setInt(i++, activityId);
			rs = call.executeQuery();
			while (rs.next()) {
				ActivityTeamConfig data = new ActivityTeamConfig(rs);
				dataMap.put(data.getParam(), data);
			}
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
			getDb().closeConnection(call, rs);
		}
		return dataMap;
	}
}
